<%if @media.url && !@media.url.empty?%>
  <h1><a href="<%=h @media.url %>"><%=h @media.nom %></a></h1>
<% else %>
  <h1><%=h @media.nom %></h1>
<% end %>
<table><tbody><tr>
<% if @media.img_src && !@media.img_src.empty? %>
  <td>
  <%  if(@media.url && !@media.url.empty?) %>
    <%=  link_to(image_tag(@media.img_src, :class => "floatTL"),@media.url) %>
  <% else %>
    <%=  image_tag(@media.img_src, :class => "floatTL") %>
  <% end %>
  </td>
<% end %>
<td>
  <%if @media.taille && !@media.taille.empty?%>
    <b>Taille:</b>
    <%=h @media.taille %><br/>
  <% end %>

  <%if @media.description && !@media.description.empty?%>
    <b>Description:</b>
    <%=h @media.description %><br/>
  <% end %>

  <%if @media.details && !@media.details.empty?%>
    <b>Details:</b>
    <%=h @media.details %><br/>
  <% end %>



  <%if @media.langue && !@media.langue.empty?%>
  <b>Langue:</b>
    <%=h @media.langue %><br/>
  <% end %>

  <%if @media.nfo && !@media.nfo.empty?%>
  <b>Nfo:</b>
    <%=h @media.nfo %><br/>
  <% end %>

  <b>Score:</b>
    <%=h @media.score %><br/>
  
  <%if @media.dl_count%>
  <b>Dl count:</b>
    <%=h @media.dl_count %><br/>
  <% end %>

  <%if @media.category_id%>
  <b>Category:</b>
    <%=link_to(@media.category.label,category_medias_path(@media.category_id)) %><br/>
  <% end %>

  <%if @media.user_id && @media.user_id > 0%>
  <b>User:</b>
    <%=link_to(@media.user.nickname,user_medias_path(@media.user_id)) %><br/>
  <% end %>

  <b>Date:</b>
  <% media_date = @media.created_at %>
  <% day_cnt = ((Time.now-media_date)/86400) %>
    <%= media_date.strftime("%Y-%m-%d %H:%M:%S") %>(<%= day_cnt.to_i %> jour(s))<br/>
</td>
</tr></tbody></table>

<% if @media.local_path && !@media.local_path.empty? %>
  <p>
      <h2>Download :</h2>
      <%= render_fs_tree(HELLA_LOCAL_DONE+'/'+ @media.local_path)%>
  </p>
<% else %>
<p>
  <%= link_to_remote 'Chercher le NZB',
    :method => :post,
    :url => {:controller => 'nzb', :action => 'search', :media_id => @media.id},
    :update => 'download_div_'+URI.escape( @media.id.to_s),
    :before => "document.getElementById('download_div_#{@media.id.to_s}').innerHTML = '<img src=\"/images/ajax-loader.gif\" alt=\"loading...\" />';" %>
</p>
 <br class="clear" />
<div id="download_div_<%= @media.id.to_s%>"></div>
 <br class="clear" />
<% end %>
<% if ((@media.user_id == session[:user].id) || (session[:user].rights>=ADMIN_USER)) %>
   <%= link_to 'Edit', edit_media_path(@media) %>
 | <%= link_to 'Destroy', @media, :confirm => 'Are you sure?', :method => :delete %>
<% end %>
 | <%= link_to 'Back', "javascript:window.history.back()" %>
 <br class="clear" />
<h3>Commentaires</h3>
<% form_for(@comment) do |f| %>
    <%= f.error_messages %>
    <%= f.hidden_field(:media_id) %>
    <%= "(#{Time.now.to_formatted_s(:db)})&nbsp;#{link_to(session[:user].nickname,user_medias_url(session[:user]))}:&nbsp;" %>
    <%= f.text_field :msg, :class => 'text' %>
    <%= f.submit "Create", :class => 'button' %>
<% end %>
<%= comment_list_by_media(Comment.find(:all, :conditions => {:media_id => @media.id}, :order => 'created_at DESC')) %>
